#include "cache.h"
#include "log.h"
#include "def.h"
#include <sstream>

Cache::Cache()
{
}
Cache::~Cache()
{
}

bool Cache::RpopApiOrderCreate(api_order::ApiOrder& api_order)
{
    std::string val;
    if (0 != m_gameOrderRedis->Rpop("apiorder:create", &val))
    {
        return false;
    }
    if (val.empty())
    {
        return false;
    }
    if (!api_order.ParseFromArray(val.data(), val.size()))
    {
        return false;
    }
    return true;
}

bool Cache::RpopApiOrderFinish(api_order::ApiOrder& api_order)
{
    std::string val;
    if (0 != m_gameOrderRedis->Rpop("apiorder:finish", &val))
    {
        return false;
    }
    if (val.empty())
    {
        return false;
    }
    if (!api_order.ParseFromArray(val.data(), val.size()))
    {
        return false;
    }
    return true;
}


